#include "LogDisplay.hpp"
#include <QPlainTextEdit>

LogDisplay::LogDisplay() : initd(false)
{
    widget = new QPlainTextEdit();
    widget->setGeometry(10,10,640,248);
    widget->show();
    initd = true;
}


void LogDisplay::initLoggerEngine() {

}

void LogDisplay::killLoggerEngine() {
    widget->deleteLater();
    initd = false;
}

void LogDisplay::writeFormatted(QxtLogger::LogLevel l, const QList<QVariant>& messages) {
    QString s;
    foreach(QVariant v, messages) {
        s.append(v.toString()).append('\n');
    }
    widget->appendPlainText(QString::number(time.absolute())+" "+QxtLogger::logLevelToString(l)+" " +s);
}
